package alibaba.client.cli;

import org.apache.commons.cli.Option;

public enum CliAction {
    
    BACKUP_FILE("backupfile", "bf", "Backup a file", 
            CLIOptions.BACKUP_FILE_OPTION,
            CLIOptions.USER_OPTION
    ), 
    
    RESTORE_FILE("restorefile", "rf", "Restore a file", 
            CLIOptions.RESTORE_FILE_OPTION,
            CLIOptions.USER_OPTION,
            CLIOptions.SNAPSHOT_NUMBER
    ),
    
    BACKUP_DIR("backupdir", "bd", "Backup a directory", 
            CLIOptions.BACKUP_DIR_OPTION,
            CLIOptions.USER_OPTION
    ),
    
    RESTORE_DIR("restoredir", "rd", "Restore a directory", 
            CLIOptions.RESTORE_DIR_OPTION,
            CLIOptions.USER_OPTION,
            CLIOptions.SNAPSHOT_NUMBER
    ),
    
    LIST("list", "ls", "List a directory", 
            CLIOptions.LIST_DIR_OPTION,
            CLIOptions.USER_OPTION,
            CLIOptions.SNAPSHOT_NUMBER
    ),
    
    CHECK("check", "ch", "Check and validate backup files", 
            CLIOptions.CHECK_DIR_OPTION,
            CLIOptions.USER_OPTION
    ),
    
    CREATE_SNANPSHOT("createsnapshot", "cs", "Create a snapshot for the user files",
            CLIOptions.USER_OPTION,
            CLIOptions.SNAPSHOT_NUMBER
    ),
    
    DELETE_SNANPSHOT("deletesnapshot", "ds", "Delete a specified user files snapshot",
            CLIOptions.USER_OPTION,
            CLIOptions.SNAPSHOT_NUMBER
    ),    
    
    // option is null because help accepts no arguments
    HELP("help", "?", "Print usage information (this screen)", (Option[])null), 
    
    // not actual commands, but it is nice putting them here
    ERROR("error", "er", "Input error. Type 'java -jar AlibabaClient.jar help' for usage", (Option[])null),
    NO_COMMAND("nop", "nop", "Type 'java -jar AlibabaClient.jar help' for usage", (Option[])null);
    
    private String shortName;
    private String longName;
    private String description;
    private Option[] options;
    
    private CliAction(String longName, String shortName, String description, Option ... options) {
        this.longName = longName;
        this.shortName = shortName;
        this.description = description;
        this.options = options;
    }

    public String getDescription() {
        return description;
    }
    
    public String getLongName() {
        return longName;
    }
    
    public String getShortName() {
        return shortName;
    }
    
    public Option[] getOptions() {
        return options;
    }
    
}
